import request from '@/utils/request'

//查询用户列表
export function getUserList(data) {
	return request({
		method: 'get',
		url: 'tbSysUser/query',
		params: data,
	})
}

//添加用户
export function addedUser(data) {
	return request({
		method: 'post',
		url: 'tbSysUser/add',
		data,
	})
}

//批量删除用户信息
export function batchDeleteUser(data) {
	return request({
		method: 'post',
		url: 'tbSysUser/batchDelete',
		data,
	})
}

//修改用户
export function updateUser(data) {
	return request({
		method: 'post',
		url: 'tbSysUser/update',
		data,
	})
}

//用户详情
export function userDetail(id) {
	return request({
		method: 'get',
		url: 'tbSysUser/query/' + id,
	})
}

//封禁/恢复用户
export function banAndRecoveryUser(data) {
	return request({
		method: 'post',
		url: 'tbSysUser/batchBanAndRecovery',
		data,
	})
}

//重置用户密码
export function updateUserPassword(data) {
	return request({
		method: 'post',
		url: 'tbSysUser/batchUpdatePassword',
		data,
	})
}

//批量修改部门
export function batchUpdateDepart(data) {
	return request({
		method: 'post',
		url: 'tbSysUser/batchUpdateDept',
		data,
	})
}

//批量修改用户的系统类型
export function batchUpdateLevel(data) {
	return request({
		method: 'post',
		url: 'tbSysUser/batchUpdateLevel',
		data,
	})
}

//导出用户数据
export function exportUser(params) {
	return request({
		method: 'get',
		url: 'tbSysUser/export',
		responseType: 'blob',
		params
	})
}

//设置用户图片
export function updateUserAvatar(data) {
	return request({
		method: 'post',
		url: 'tbSysUser/updatePic',
		data,
	})
}

//查询用户学习时长
export function queryUserDuration(params) {
	return request({
		method: 'get',
		url: 'tbSysUser/queryStudentStudyDuration',
		params
	})
}

//导出用户学习时长
export function exportDurationUser(params) {
	return request({
		method: 'get',
		url: 'tbSysUser/exportStudentStudyDuration',
		responseType: 'blob',
		params
	})
}